package com.huiyun.project.im.server.biz.framework;

import com.huiyun.project.im.common.auth.GatewayFilter;
import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.Ordered;

/**
 * @FileName:
 * @Description:
 * @Author linjie
 * @Date 2020/7/252:47 PM
 * @Version 4.0.0
 */
@Configuration("3579hosu952i6sf353f")
public class FilterConfig {

    /**
     * 启用清洗网关请求头的的操作,如果请求没有经过网关项目,则此处负责标记请求是否是外部的rest请求
     *
     * @return
     */
    @Bean
    public FilterRegistrationBean filterRegistrationBean() {
        FilterRegistrationBean bean = new FilterRegistrationBean();
        bean.setFilter(new GatewayFilter());
        bean.addUrlPatterns("/im/*");
        bean.setOrder(Ordered.HIGHEST_PRECEDENCE);
        return bean;
    }

}
